package com.mybatis.sqlSession;

import com.mybatis.config.XMLConfigBuilder;
import com.mybatis.pojo.Configuration;
import org.dom4j.DocumentException;

import java.beans.PropertyVetoException;
import java.io.InputStream;

public class SqlSessionFactoryBuilder {

    public SqlSessionFactory build(InputStream in) throws DocumentException, PropertyVetoException {
        XMLConfigBuilder configBuilder = new XMLConfigBuilder();
        Configuration configuration = configBuilder.parseConfig(in);

        DefaultSqlSessionFactory sessionFactory
                = new DefaultSqlSessionFactory(configuration);
        return sessionFactory;
    }
}
